package com.zym.init.enums;

import lombok.Getter;

/**
 * 操作日志状态枚举
 *
 * @author ZouYangMing
 */
@Getter
public enum OperationLogStatusEnum {
    /**
     * 成功
     */
    SUCCESS("1", "成功"),
    /**
     * 失败
     */
    FAILURE("2", "失败");

    private final String status;

    private final String text;

    OperationLogStatusEnum(String status, String text) {
        this.status = status;
        this.text = text;
    }

    /**
     * 校验范围
     *
     * @param status 状态
     * @return 结果
     */
    public static boolean isValidCode(String status) {
        if (status == null) {
            return false;
        }
        for (OperationLogStatusEnum s : OperationLogStatusEnum.values()) {
            if (s.getStatus().equals(status)) {
                return true;
            }
        }
        return false;
    }

}
